package BugzillaJsonRpc::Config;
use 5.018;
use warnings;
my $config_fpath = "$ENV{HOME}/.config/BugzillaJsonRpc.cfg";
use Config::Tiny;
use Digest::SHA qw(sha1_hex);

sub new
{
	die "BugzillaJsonRpc config file `$config_fpath` not exists." unless -f $config_fpath;
	my $c = Config::Tiny->read($config_fpath);
	my $using = $c->{_}{use};
	return bless $c->{$using}, $_[0];
}

sub getSha1Hex
{
	my $self = $_[0];
	my $str;
	for (sort keys %$self)
	{
		$str .= $self->{$_};
	}
	my $hex = sha1_hex $str;
	warn "getSha1Hex: hex is $hex";
	return $hex
}


1;
